package domain

import (
	"time"
)

const (
	ClubUserStructFieldUser     = "User"
	ClubUserStructFieldPosition = "Position"
	ClubUserStructFieldClub     = "Club"
)

type ClubUserStruct struct {
	ID         int64            `json:"id"`
	UserID     int64            `json:"-" gorm:"not null"`
	ParentID   *int64           `json:"-"`
	PositionID *int64           `json:"-"`
	ClubID     *int64           `json:"-"`
	CreatedAt  time.Time        `json:"created_at" `
	UpdatedAt  int64            `json:"updated_at" `
	Parent     *ClubUserStruct  `json:"parent" gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	Children   []ClubUserStruct `json:"children" gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	User       User             `json:"user" gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Position   *ClubPosition    `json:"position" gorm:"foreignKey:PositionID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	Club       *Club            `json:"club" gorm:"foreignKey:ClubID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
}
type ClubUserStructDTO struct {
	ID         int64               `json:"id"`
	UserID     int64               `json:"-" gorm:"not null"`
	ParentID   *int64              `json:"-"`
	PositionID *int64              `json:"-"`
	ClubID     *int64              `json:"-"`
	CreatedAt  time.Time           `json:"created_at" `
	UpdatedAt  int64               `json:"updated_at" `
	Parent     *ClubUserStructDTO  `json:"parent" gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	Children   []ClubUserStructDTO `json:"children" gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	User       UserDTO             `json:"user" gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Position   *ClubPositionDTO    `json:"position" gorm:"foreignKey:PositionID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	Club       *ClubDTO            `json:"club" gorm:"foreignKey:ClubID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
}
